type DictType = Array<{ label: string; value: string }>;

export const exerciseTypeOption: DictType = [
  { value: '0', label: '素食' },
  { value: '1', label: '蛋白质' },
  { value: '2', label: '肉' },
  { value: '3', label: '鱼' },
  { value: '4', label: '其他' },
];

export const exerciseFrequencyOption: DictType = [
  { value: '0', label: '每天一次' },
  { value: '1', label: '每天两次' },
  { value: '2', label: '每天三次' },
];

/**
 * 根据value和字典获取label
 * @param value
 * @param dict
 * @returns
 */
export function getLabelByValue(value: string, dict: DictType): string {
  const option = dict.find((option) => option.value === value);
  return option ? option.label : '';
}
